<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">
	//获取当前页面的路径并由?切割接收0下标的精准路径
	var url = window.location.href.split("?")[0];
	url = url.substring(url.lastIndexOf("/"));
	// alert(url)
	//切换页码链接
	function goTuUrl2(pageNum) {
		//判断如果当前页面是User用户页面进入
		if (url == "/show" || url == "/show#") {
			var fromAction = "show?pageNum=" + pageNum;	//在提交的路径后面问号传当前点击的页号
			//切换页号是保留条件
			document.getElementsByTagName("form")[0].action = fromAction;	//将from表单的action加上问号传的值
			document.getElementsByTagName("form")[0].submit();	//提交from表单
		}
		// //判断如果当前页面是Bill订单页面进入
		// if (url == "/BillListServlet" || url == "/BillAddServlet" || url == "/BillModifyServlet" || url == "/BillListServlet#") {
		// 	var fromAction = "BillListServlet?pageNum=" + pageNum;
		// 	//切换页号是保留条件
		// 	document.getElementsByTagName("form")[0].action = fromAction;
		// 	document.getElementsByTagName("form")[0].submit();	//提交fro
		// }
		// //判断如果当前页面是Provider供应商页面进入
		// if (url == "/ProviderListServlet" || url == "/ProviderAddServlet" || url == "/ProviderModifyServlet" || url == "/ProviderListServlet#") {
		// 	var fromAction = "ProviderListServlet?pageNum=" + pageNum;
		// 	//切换页号是保留条件
		// 	document.getElementsByTagName("form")[0].action = fromAction;
		// 	document.getElementsByTagName("form")[0].submit();	//提交fro
		// }
	}

	//表单输入链接
	function goToUrl(){
		pageNum = $("#inputPage").val();	//获取表单输入的值
		if (url == "/show" || url == "/show") {
			var fromAction ="show?pageNum="+pageNum;
			document.getElementsByTagName("form")[0].action = fromAction;
			document.getElementsByTagName("form")[0].submit();
		}
		// if (url == "/BillListServlet" || url == "/BillAddServlet" || url == "/BillModifyServlet") {
		// 	var fromAction ="BillListServlet?pageNum="+pageNum;
		// 	document.getElementsByTagName("form")[0].action = fromAction;
		// 	document.getElementsByTagName("form")[0].submit();
		// }
		// if (url == "/ProviderListServlet" || url == "/ProviderAddServlet" || url == "/ProviderModifyServlet") {
		// 	var fromAction ="ProviderListServlet?pageNum="+pageNum;
		// 	document.getElementsByTagName("form")[0].action = fromAction;
		// 	document.getElementsByTagName("form")[0].submit();
		// }
	}
</script>
<body>
 		<div class="page-bar">
			<ul class="page-num-ul clearfix">
				<li>共${requestScope.pageInfo.total }条记录&nbsp;&nbsp; ${requestScope.pageInfo.pageNum }/${requestScope.pageInfo.pages }页</li>
				<c:if test="${requestScope.pageInfo.pageNum > 1}">
<%--					问号传值--%>
					<a href="javascript:goTuUrl2(1);">首页</a>
					<a href="javascript:goTuUrl2(${requestScope.pageInfo.pageNum-1 });">上一页</a>
				</c:if>
				<c:if test="${requestScope.pageInfo.pageNum < requestScope.pageInfo.pages }">
					<a href="javascript:goTuUrl2(${requestScope.pageInfo.pageNum+1 });">下一页</a>
					<a href="javascript:goTuUrl2(${requestScope.pageInfo.pages });">最后一页</a>
				</c:if>
				&nbsp;&nbsp;
			</ul>
		 <span class="page-go-form"><label>跳转至</label>
	     <input type="text" name="pageNum" id="inputPage" class="page-key" />页
				 <button type="button" class="page-btn" onclick="goToUrl()">GO</button>
		</span>
		</div> 
</body>
<script type="text/javascript" src="/js/rollpage.js"></script>
</html>